﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace AutoLoL.Entities
{
    public class RafFile
    {
        public string Path { get; private set; }

        private string[] _pathChunks;
        public string[] PathChunks
        {
            get
            {
                if (_pathChunks == null)
                {
                    _pathChunks = Path.Split(new char[] { '/' });
                }

                return _pathChunks;
            }
        }

        public UInt32 FileOffset { get; private set; }

        public UInt32 FileSize { get; private set; }

        public RafArchive RafArchive { get; private set; }

        public byte[] Data { get; private set; }

        public RafFile(string path, UInt32 fileOffset, UInt32 fileSize, RafArchive rafArchive)
        {
            this.Path = path;
            this.FileOffset = fileOffset;
            this.FileSize = fileSize;
            this.RafArchive = rafArchive;
        }

        public void SetData(byte[] data)
        {
            if (Data == null)
            {
                this.Data = data;
            }
        }
    }
}